package com.leoman.feedback.service.impl;

import com.leoman.common.controller.common.CommonController;
import com.leoman.common.service.impl.GenericManagerImpl;
import com.leoman.feedback.dao.FeedbackDao;
import com.leoman.feedback.entity.Feedback;
import com.leoman.feedback.service.FeedBackService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 蔡琦 on 2016/7/1 0001.
 *
 */
@Service
public class FeedBackServiceImpl extends GenericManagerImpl<Feedback, FeedbackDao> implements FeedBackService {

    @Autowired
    private FeedbackDao feedbackDao;

    @Override
    public Page<Feedback> page(Integer pageNum, Integer pageSize) {
        return feedbackDao.findAll(new PageRequest(pageNum - 1,pageSize, Sort.Direction.DESC,"id"));
    }

    @Override
    public List<Feedback> findListNew() {
        return feedbackDao.findListNew(CommonController.getOldDate());
    }
}
